home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-04-08 | 28.6 KB | 847 lines | [TEXT/MPS ] |
- ;====================================================================================
- ;
- ; HackRecorder.a
- ;
- ; Copyright © 1990 Apple Computer, Inc.
- ;
- ; Sound Input Driver Example
- ;
- ; Revision History
- ;
- ; 04/01/91 No changes except added this comment line: Submitted as item for developer CD.
- ; 12/10/90 Updated to support continous recording selector.
- ; 11/19/90 First created.
- ;
- ;====================================================================================
-
- INCLUDE 'Traps.a'
- INCLUDE 'SysErr.a'
- INCLUDE 'SysEqu.a'
- INCLUDE 'Sound.a'
-
- CASE OBJ
- MACHINE MC68000
-
- ;_______________________________________________________________________
- ;
- ; Constants
- ;
- ;_______________________________________________________________________
-
- rate7khz EQU $1CFA2E8B ; 7418.1818 samples/second
- eightBits EQU 8 ; we support 8-bit samples only
- hardwareChannels EQU 1 ; we support only one channel.
- oneFactor EQU 1 ; compression factor for no compression
- siContinousOnOff EQU 'cont' ; continous recording selector (will be in interfaces soon)
-
- ;_______________________________________________________________________
- ;
- ; Local driver variables (pointed to by DCtlStorage)
- ;
- ;_______________________________________________________________________
-
- DrvrStorage RECORD 0
- RequestParamPtr DS.L 1 ; pointer to param block passed in by read,control,etc.
- SampleSize DS.W 1 ; current sample size
- SampleRate DS.L 1 ; current sample rate
- NumberOfChannels DS.W 1 ; current number of channels
- CompType DS.L 1 ; compression type
- AppBufferPtr DS.L 1 ; pointer to application buffer
- AppBufferLength DS.L 1 ; length of application buffer in bytes
- userInterrupt DS.L 1 ; pointer to user interrupt routine
- levelMeterFlag DS.W 1 ; 1 = level metering on; 0 = level metering off
- contFlag DS.W 1 ; 1 = continous recording on; 0 = continous recording off
- pauseFlag DS.W 1 ; 1 = paused, 0 = unpaused
- twosFlag DS.W 1 ; 1 = return 2's complement sampls, 0 = return offset binary samples
- currentLevel DS.W 1 ; current level meter value
- drvrStorageSize EQU * ; size of DrvrStorage
- ENDR
-
- ;_______________________________________________________________________
- ;
- ;The code starts here!
- ;
- ;_______________________________________________________________________
-
- SEG '.HackRecorder'
- PROC ENTRY
- WITH DrvrStorage
-
- ;The Driver Header: This is the address installed in the driver's Device Control Entry,
- ;so that all the standard Macintosh driver header info is in the right place.
-
- HackRecorder DC.W $4D00 ; read, control, status, needs lock
- DC.W 0 ; no delay
- DC.W 0 ; no EMask
- DC.W 0 ; no menu
-
- ; Entry point offset table
- DC.W HackRecorderOpen-HackRecorder ; open
- DC.W HackRecorderRead-HackRecorder ; prime
- DC.W HackRecorderControl-HackRecorder ; control
- DC.W HackRecorderStatus-HackRecorder ; status
- DC.W HackRecorderClose-HackRecorder ; close
-
- STRING PASCAL
- HackRecorderName
- DC.B '.HackRecorder' ; name for this driver
- ALIGN 2
-
- JIOOut MOVE.L JIODone,A0 ; use IODone vector
- JMP (A0) ; we don't come back from this one!
-
-
- ;_______________________________________________________________________
- ;
- ; Routine: HackRecorderOpen
- ; Allocate & initialize driver locals.
- ;
- ; Arguments: A0 (input) -- pointer to request parameter block (not used in this example)
- ; A1 (input) -- pointer to disk DCE
- ;
- ;
- ; Registers Used:
- ; A0 -- holds Ptr to the DrvrStorage Data Record
- ; D0 -- temp and result
- ;
- ;_______________________________________________________________________
-
- HackRecorderOpen
-
- MOVEM.L D3-D4/A2, -(SP) ;save registers
-
- MOVE.L #drvrStorageSize, D0 ; get memory for SoundIn storage variables
- _NewPtr ,sys,clear ; storage is now off A0
- MOVE.L A0, D0
- BEQ.S noMemory
-
- MOVE.L A0, dCtlStorage(A1) ; keep the locals ptr in the DCE
- MOVE.L A0, A2 ; we thrash A0 soon
-
- ; Initialize local variables
-
- MOVE.W #hardwareChannels, NumberOfChannels(A2) ; 1 channel
- MOVE.L #rate22khz, SampleRate(A2) ; 22khz
- MOVE.W #eightBits,SampleSize(A2) ; 8 bit samples
- MOVE.L #noneCompType,CompType(A2) ;no compression
- ;MOVE.W #0,levelMeterFlag(A2) ; already cleared above
- MOVE.W #127,currentLevel(A2) ; default level
-
- MOVEQ #0,D0 ;success
- MOVEM.L (SP)+,D3-D4/A2 ;restore registers
- RTS ;All done with Open!
-
- noMemory
- MOVE.W #memFullErr,D0 ;a NewPtr or NewHandle failed
- MOVEM.L (SP)+,D3-D4/A2 ;restore registers
- RTS
-
-
- ;_______________________________________________________________________
- ;
- ; Routine: HackRecorderRead
- ; Arguments: A0 (input) -- pointer to request parameter block
- ; A1 (input) -- pointer to disk DCE
- ;
- ; The "prime" entry point is used for read only.
- ;
- ; Registers Used:
- ; A2 -- holds Ptr to the dCtlStorage
- ; A3 -- Ptr to application buffer
- ; D0 -- counter and result
- ; D1 -- generated sample value
- ;
- ;_______________________________________________________________________
-
- HackRecorderRead
-
- MOVEM.L D3-D7/A3-A5, -(SP) ;save all of the registers
- MOVE.L dCtlStorage(A1), A2 ;get a pointer to our data record
-
- MOVE.L A0, RequestParamPtr(A2) ;save pointer to the request parameter block
- MOVE.L ioBuffer(A0), AppBufferPtr(A2) ;save pointer to the application buffer
- MOVE.L ioReqCount(A0), AppBufferLength(A2) ;save # of bytes to read
-
- ; Here is where you would start your hardware recording. This example
- ; just generates a square wave and returns.
-
- MOVEQ #0,D1
- MOVE.L ioBuffer(A0),A3 ;start at top of applicaton buffer
- MOVE.L ioReqCount(A0),D0 ;generate this many samples
- BRA.S @loopCheck ;go to loop check to decrement counter first time through
-
- @loopStart
- MOVE.B D1,(A3)+ ;store sample in application buffer
- MOVE.L D0,D2
- ANDI.W #$0007,D2 ;time to switch square wave phase?
- BNE.S @loopCheck ;no, so continue
- NOT.B D1 ;toggle square wave phase
-
- @loopCheck SUBQ.L #1,D0
- BNE.S @loopStart
-
- MOVE.L ioReqCount(A0),ioActCount(A0) ;store the # bytes recorded
-
- MOVEM.L (SP)+,D3-D7/A3-A5 ;restore all of the registers
-
- BRA JIOOut ;common exit to JIODone
-
-
- ;_______________________________________________________________________
- ;
- ; Routine: HackRecorderControl
- ; Arguments: A0 (input) -- pointer to control call parameter block
- ; A1 (input) -- pointer to this device's DCE
- ;
- ;
- ;_______________________________________________________________________
-
- HackRecorderControl
-
- MOVEM.L A2-A3,-(SP) ;save unpreserved regs; restored in CSJIOOut & CSJIOErrorOut
-
- MOVE.L DCtlStorage(A1),A2 ;get ptr to our storage
- MOVE.W CSCode(A0),D0 ;get the control code
- BEQ.S ctCodeBad
- SUBQ.W #1,D0 ;is csCode = KillIO
- BEQ killIO
- SUBQ.W #1,D0 ;is csCode = 2 then this is our InfoType code
- BEQ.S ctcodeOK
- ctCodeBad
- MOVE #controlErr,D0
- BRA CSJIOErrorOut ;common exit to JIODone
-
- ctcodeOK MOVE.L csParam(A0),D0 ;csParam contains the data passed to the control call
-
- CMPI.L #siInitializeDriver,D0
- BEQ.S InitDriverState
-
- CMPI.L #siCloseDriver,D0
- BEQ.S CloseDriverState
-
- CMPI.L #siPauseRecording,D0
- BEQ setPause
-
- CMPI.L #siRecordingQuality,D0
- BEQ setQuality
-
- CMPI.L #siSampleSize,D0
- BEQ setSampleSize
-
- CMPI.L #siSampleRate,D0
- BEQ setSampleRate
-
- CMPI.L #siNumberChannels,D0
- BEQ setNumberOfChannels
-
- CMPI.L #siCompressionType,D0
- BEQ setCompression
-
- CMPI.L #siLevelMeterOnOff,D0
- BEQ setLevelMeter
-
- CMPI.L #siContinousOnOff,D0
- BEQ setContinuous
-
- CMPI.L #siTwosComplementOnOff,D0
- BEQ setTwos
-
- CMPI.L #siUserInterruptProc,D0
- BEQ setUserInterrupt
-
- MOVE #siUnknownInfoType,D0
- BRA CSJIOErrorOut ;common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- killIO
-
- ; Here you want to stop recording with your hardware. If an asynchronous
- ; Read was in progress, you would disable your hardware interrupt here. This
- ; example is always synchronous, so it just returns.
-
- MOVEM.L (SP)+,A2-A3 ;save unpreserved regs
- RTS ;KillIO call MUST return by an RTS
-
- ;----------------------------------------------------------------------------------------------
-
- InitDriverState
- CloseDriverState
-
- ; Init: Here you want to allocate your hardware and initialize default settings.
- ; Close: Deallocate your hardware and reset settings.
- ; This example just initializes globals for both selectors.
-
- MOVE.W #hardwareChannels,NumberOfChannels(A2) ; 1 channel
- MOVE.L #rate22khz,SampleRate(A2) ; 22khz
- MOVE.W #eightBits,SampleSize(A2) ; 8-bit samples
- MOVE.L #noneCompType,CompType(A2) ; no compression
- MOVE.W #0,levelMeterFlag(A2) ; no level metering
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- setPause
-
- ; Here you want to pause your hardware. This can be done by setting a pause flag
- ; which tells the interrupt service routine to not copy samples to the application
- ; buffer until the flag is cleared again. This example just stores the pause setting.
-
- MOVE.W csParam+4(A0),pauseFlag(A2) ;store new pause setting
-
- BRA CSJIOOut ;common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- setQuality
-
- ; Here you want to set up various recording features depending on the quality passed.
- ; This example just changes the rate depending on the quality.
-
- MOVE.L csParam+4(A0),D0 ;get the quality type
-
- CMPI.L #siBestQuality,D0 ;best quality?
- BNE.S @tryBetter
- MOVE.L #rate22khz,SampleRate(A2) ;use 22 kHz
- BRA.S @qualityOK
-
- @tryBetter CMPI.L #siBetterQuality,D0 ;better quality?
- BNE.S @tryGood
- MOVE.L #rate11khz,SampleRate(A2) ;use 11 kHz
- BRA.S @qualityOK
-
- @tryGood CMPI.L #siGoodQuality,D0 ;good quality?
- BNE.S @unknown
- MOVE.L #rate7khz,SampleRate(A2) ;use 7 kHz
-
- @qualityOK MOVE.W #hardwareChannels,NumberOfChannels(A2) ; 1 channel
- MOVE.W #eightBits,SampleSize(A2) ;8-bit samples
- MOVE.L #noneCompType,CompType(A2) ;no compression
- BRA CSJIOOut ;common exit to JIODone
-
- @unknown MOVE #siUnknownQuality,D0 ;quality not supported
- BRA CSJIOErrorOut ;common exit to JIODone with error
-
- ;----------------------------------------------------------------------------------------------
-
- setSampleSize
- MOVE.W csParam+4(A0),D0 ;get the sample size
-
- CMPI.W #eightBits,D0 ;we only support 8-bit samples
- BNE.S @unknown
- BRA CSJIOOut ;common exit to JIODone
-
- @unknown MOVE #siInvalidSampleSize,D0 ;sample size not supported
- BRA CSJIOErrorOut ;common exit to JIODone with error
-
- ;----------------------------------------------------------------------------------------------
-
- setSampleRate
- MOVE.L csParam+4(A0),D0 ;get the compression type
-
- CMPI.L #rate22khz,D0 ;is is 22 kHz?
- BEQ.S @rateOk
-
- CMPI.L #rate11khz,D0 ;is is 11 kHz?
- BEQ.S @rateOk
-
- CMPI.L #rate7khz,D0 ;is is 7 kHz?
- BEQ.S @rateOk
-
- MOVE #siInvalidSampleRate,D0 ;sample rate not supported
- BRA CSJIOErrorOut ;common exit to JIODone with error
-
- @rateOK MOVE.L D0,SampleRate(A2) ;save new rate
- BRA CSJIOOut ;common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- setNumberOfChannels
- MOVE.W csParam+4(A0),D0 ;get the number of channels
-
- CMPI.W #hardwareChannels,D0 ;we only support 1 channel
- BNE.S @unknown
- BRA CSJIOOut ;common exit to JIODone
-
- @unknown MOVE #notEnoughHardware,D0 ;hardware does not support this many channels
- BRA CSJIOErrorOut ;common exit to JIODone with error
-
- ;----------------------------------------------------------------------------------------------
-
- setCompression
- MOVE.L csParam+4(A0),D0 ;get the compression type
-
- CMPI.L #noneCompType,D0 ;we only support no compression
- BNE.S @unknown
- BRA CSJIOOut ;common exit to JIODone
-
- @unknown MOVE #siInvalidCompression,D0 ;compression type not supported
- BRA CSJIOErrorOut ;common exit to JIODone with error
-
- ;----------------------------------------------------------------------------------------------
-
- setLevelMeter
-
- ; Here you may want to start recording into an internal buffer and calculating a
- ; meter level value during the interrupt.
-
- MOVE.W csParam+4(A0),levelMeterFlag(A2) ;store new level meter setting
-
- BRA CSJIOOut ;common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- setContinuous
-
- ; This flag tells the Read routine to record data to an internal ring buffer
- ; between Read calls. This example is synchronous, so it does not need to do this.
-
- MOVE.W csParam+4(A0),contFlag(A2) ;store new continous setting
-
- BRA CSJIOOut ;common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- setTwos
-
- ; If this flag is set, you need to convert the samples to two's complement before
- ; writing them to the application buffer. This can be done easily by XOR-ing each
- ; sample with $80 (ie. EORI.B #$80,D0). This example does not do this, but your
- ; driver should.
-
- MOVE.W csParam+4(A0),twosFlag(A2) ;store new two's complement setting
-
- BRA CSJIOOut ;common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- setUserInterrupt
-
- ; Store the proc pointer to call every interrupt. This example is synchronous,
- ; so it does not call this routine.
-
- MOVE.L csParam+4(A0),userInterrupt(A2) ;store user interrupt proc
-
- BRA CSJIOOut ;common exit to JIODone
-
-
- ;_______________________________________________________________________
- ;
- ; Routine: HackRecorderStatus
- ; Arguments: A0 (input) -- pointer to control call parameter block
- ; A1 (input) -- pointer to this device's DCE
- ;
- ;_______________________________________________________________________
-
- HackRecorderStatus
-
- MOVEM.L A2-A3,-(SP) ;save unpreserved regs
-
- MOVE.L DCtlStorage(A1),A2 ;get ptr to our storage
- MOVE.W CSCode(A0),D0 ;get the control code
- BEQ.S stCodeBad
- SUBQ.W #2,D0 ;is csCode = 2 then this is our InfoType code
- BEQ.S stcodeOK
- stCodeBad
- MOVE #statusErr,D0
- BRA CSJIOErrorOut ;common exit to JIODone
-
-
- stcodeOK MOVE.L csParam(A0),D0 ;csParam contains the data passed to the control call
-
- CMPI.L #siPauseRecording,D0
- BEQ getPause
-
- CMPI.L #siSampleSize,D0
- BEQ getCurrentSampleSize
-
- CMPI.L #siSampleSizeAvailable,D0
- BEQ getSampleSizes
-
- CMPI.L #siSampleRate,D0
- BEQ getCurrentSampleRate
-
- CMPI.L #siSampleRateAvailable,D0
- BEQ getSampleRates
-
- CMPI.L #siNumberChannels,D0
- BEQ getNumberOfChannels
-
- CMPI.L #siChannelAvailable,D0
- BEQ getNumberOfChannelsAvailable
-
- CMPI.L #siCompressionType,D0
- BEQ getCompression
-
- CMPI.L #siCompressionAvailable,D0
- BEQ getCompressionTypes
-
- CMP.L #siCompressionFactor,D0
- BEQ getCompressionFactor
-
- CMPI.L #siLevelMeterOnOff,D0
- BEQ getLevelMeterOnOff
-
- CMPI.L #siContinousOnOff,D0
- BEQ getContinuous
-
- CMPI.L #siAsync,D0
- BEQ getAsync
-
- CMPI.L #siDeviceConnected,D0
- BEQ deviceConnected
-
- CMPI.L #siTwosComplementOnOff,D0
- BEQ getTwos
-
- CMPI.L #siDeviceBufferInfo,D0
- BEQ getBufferSize
-
- CMPI.L #siDeviceName,D0
- BEQ getDeviceName
-
- CMPI.L #siDeviceIcon,D0
- BEQ getDeviceIcon
-
- MOVE #siUnknownInfoType,D0
- BRA CSJIOErrorOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getPause
- MOVE.L #2,csParam(A0) ; number of bytes of data sent back
- MOVE.W pauseFlag(A2),csParam+4(A0) ; return current pause state
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getCurrentSampleSize
- MOVE.L #2,csParam(A0) ; number of bytes of data sent back
- MOVE.W SampleSize(A2),csParam+4(A0) ; return current sample size in use by our hardware
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getSampleSizes
- MOVE.L #6,csParam(A0) ; number of bytes of data sent back
-
- MOVE.L A0,A3 ; NewHandle trashes A0 so use A3
- MOVE.L #2,D0 ; make room for one sample size
- _NewHandle
- BEQ.S @handleOK ; trap dispatcher tests D0
-
- MOVE.L A3,A0 ; get drvr param block ptr back into A0
- BRA CSJIOErrorOut ; common exit to JIODone with error
-
- @handleOK
- MOVE.L (A0),A2 ; get Ptr to data block
- MOVE.W #eightBits,(A2) ; eight bits per sample is our only option
- MOVE.W #1,csParam+4(A3) ; number of sample sizes we support
- MOVE.L A0,csParam+6(A3) ; return handle to table
-
- MOVE.L A3,A0 ; get drvr param block ptr back into A0
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getCurrentSampleRate
- MOVE.L #4,csParam(A0) ; number of bytes of data sent back
- MOVE.L SampleRate(A2),csParam+4(A0) ; return current sample rate in use by our hardware
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getSampleRates
- MOVE.L #6,csParam(A0) ; number of bytes of data sent back
-
- MOVE.L A0,A3 ; NewHandle trashes A0 so use A3
- MOVE.L #12,D0 ; make room for three sample rates
- _NewHandle
- BEQ.S @handleOK ; trap dispatcher tests D0
-
- MOVE.L A3,A0 ; get drvr param block ptr back into A0
- BRA CSJIOErrorOut ; common exit to JIODone with error
-
- @handleOK
- MOVE.L (A0),A2 ; get Ptr to data block
- MOVE.L #rate22khz,(A2) ; stuff rates we support into handle
- MOVE.L #rate11khz,4(A2)
- MOVE.L #rate7khz,8(A2)
- MOVE.W #3,csParam+4(A3) ; we support 3 sample rates
- MOVE.L A0,csParam+6(A3) ; return handle to table
-
- MOVE.L A3,A0 ; get drvr param block ptr back into A0
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getNumberOfChannels
- MOVE.L #2,csParam(A0) ; number of bytes of data sent back
- MOVE.W NumberOfChannels(A2),csParam+4(A0) ; return the number of channels in use by our hardware
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getNumberOfChannelsAvailable
- MOVE.L #2,csParam(A0) ; number of bytes of data sent back
- MOVE.W #hardwareChannels,csParam+4(A0) ; only one channel avail here
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getCompression
- MOVE.L #4,csParam(A0) ; number of bytes of data sent back
- MOVE.L #noneCompType,csParam+4(A0) ; return the compression OSType
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getCompressionTypes
-
- ; Even though this example does not support compression, you still want to create a
- ; handle of zero length and return it to the applicaton, setting the number of
- ; compression types to zero. This way the application always has a handle to dispose
- ; after making this call.
-
- MOVE.L #6,csParam(A0) ; number of bytes of data sent back
-
- MOVE.L A0,A3 ; NewHandle trashes A0 so use A3
- MOVE.L #0,D0 ; we don't support any compression, so return 0-length handle
- _NewHandle
- BEQ.S @handleOK ; trap dispatcher tests D0
-
- MOVE.L A3,A0 ; get drvr param block ptr back into A0
- BRA CSJIOErrorOut ; common exit to JIODone with error
-
- @handleOK
- MOVE.W #0,csParam+4(A3) ; we don't support any compression types
- MOVE.L A0,csParam+6(A3) ; return handle to table
-
- MOVE.L A3,A0 ; get drvr param block ptr back into A0
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getCompressionFactor
- MOVE.L #2,csParam(A0) ; number of bytes of data sent back
- MOVE.W #oneFactor,csParam+4(A0) ; return compression factor
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getLevelMeterOnOff
- MOVE.L #4,csParam(A0) ; number of bytes of data sent back
- MOVE.W levelMeterFlag(A2),csParam+4(A0) ; return the level meter On/Off Flag
- MOVE.W currentLevel(A2),csParam+6(A0) ; return the current meter level
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getContinuous
- MOVE.L #2,csParam(A0) ; number of bytes of data sent back
- MOVE.W contFlag(A2),csParam+4(A0) ; return current continous recording setting
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getAsync
- MOVE.L #2,csParam(A0) ; number of bytes of data sent back
- MOVE.W #0,csParam+4(A0) ; we do not support asynchronous driver calls
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- deviceConnected
- MOVE.L #2,csParam(A0) ; number of bytes of data sent back
- MOVE.W #siDeviceIsConnected,csParam+4(A0) ; device is plugged in and ready to go
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getTwos
- MOVE.L #2,csParam(A0) ; number of bytes of data sent back
- MOVE.W twosFlag(A2),csParam+4(A0) ; return current two's complement setting
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getBufferSize
- MOVE.L #4,csParam(A0) ; number of bytes of data sent back
- MOVE.L #0,csParam+4(A0) ; return size of internal buffer
-
- BRA CSJIOOut ; common exit to JIODone
-
- ;----------------------------------------------------------------------------------------------
-
- getDeviceName
- MOVE.L #0,csParam(A0) ; number of bytes of data sent back
- MOVE.L csParam+4(A0),A1 ; Ptr to name space
- MOVE.L A0,-(SP) ; save the param Ptr
- LEA @deviceName,A0 ; Ptr to this device's name
- MOVEQ #0,D0
- MOVE.B (A0),D0 ; length of the name string
- ADDQ #1,D0 ; don't forget the length byte
- _BlockMove
-
- MOVE.L (SP)+,A0 ; restore the param Ptr
- BRA CSJIOOut ; common exit to JIODone
-
- STRING PASCAL
- @deviceName DC.B 'HackRecorder'
- ALIGN 2
-
- ;----------------------------------------------------------------------------------------------
-
- getDeviceIcon
- MOVE.L #4,csParam(A0) ; number of bytes of data sent back
-
- MOVE.L A0,A3 ; NewHandle trashes A0 so use A3
- MOVE.L #256,D0 ; make room for icon data
- _NewHandle
- BEQ.S @handleOK ; trap dispatcher tests D0
-
- MOVE.L A3,A0 ; get drvr param block ptr back into A0
- BRA CSJIOErrorOut
-
- @handleOK
- MOVE.L A0,csParam+4(A3) ; return handle to icon
- MOVE.L (A0),A1 ; get Ptr to data block
- LEA @deviceIcon,A0 ; Ptr to this device's name
- MOVE.L #256,D0 ; length of the Icon data
- _BlockMove ; copy icon and mask to handle
-
- MOVE.L A3,A0 ; get drvr param block ptr back into A0
- BRA CSJIOOut ; common exit to JIODone
-
- @deviceIcon
- ; Device Icon
- DC.W $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0600
- DC.W $0000,$0900,$0000,$1200,$0000,$2100,$0000,$4080
- DC.W $0000,$4240,$0000,$8230,$0000,$8018,$0001,$0018
- DC.W $0002,$00F0,$0006,$06C0,$000E,$0946,$001C,$08C0
- DC.W $003C,$7008,$0078,$7024,$30F0,$7020,$4908,$3000
- DC.W $9208,$1000,$A209,$1000,$A409,$1000,$A449,$1000
- DC.W $A849,$1000,$9049,$1000,$8045,$8800,$4082,$4400
- DC.W $3FFC,$3800,$0000,$0000,$0000,$0000,$0000,$0000
-
- DC.W $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0600
- DC.W $0000,$0F00,$0000,$1E00,$0000,$3F00,$0000,$7F80
- DC.W $0000,$7FC0,$0000,$FFF0,$0000,$FFF8,$0001,$FFF8
- DC.W $0003,$FFF0,$0007,$FFC0,$000F,$F9C6,$001F,$F8C0
- DC.W $003F,$F008,$007F,$F024,$30FF,$F020,$79FF,$F000
- DC.W $F3FF,$F000,$E3FF,$F000,$E7FF,$F000,$E7FF,$F000
- DC.W $EFFF,$F000,$FFFF,$F000,$FFFF,$F800,$7FFE,$7C00
- DC.W $3FFC,$3800,$0000,$0000,$0000,$0000,$0000,$0000
-
- ;----------------------------------------------------------------------------------------------
-
- ; Common exit for control and status calls
-
- CSJIOOut
- MOVEQ #0,D0 ;noError if Select exits here
- CSJIOErrorOut
- MOVE.W ioTrap(A0),D1
- BTST.L #noQueueBit,D1 ;is this call an immediate call?
- MOVEM.L (SP)+,A2-A3 ;save unpreserved regs
- BNE.S @isImmediate
-
- BRA JIOOut ;common exit to JIODone
-
- @isImmediate
- RTS
-
- ;_______________________________________________________________________
- ;
- ; Routine: HackRecorderClose
- ; Arguments: A0 (input) -- pointer to call parameter block
- ; A1 (input) -- pointer to this device's DCE
- ;
- ;_______________________________________________________________________
-
- HackRecorderClose
- MOVE.L dCtlStorage(A1),A2 ;keep the locals ptr in the DCE
-
- MOVE.L A2,A0 ;dispose driver storage area
- _DisposPtr
-
- RTS
-
- END